package com.itheima.tliassystem;

import com.itheima.tliassystem.uile.JwtUtils;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.HashMap;
import java.util.Map;

@SpringBootTest
public class JjwtTset {
    @Test
    public void jjwtTset() {
        Map map = new HashMap();
        map.put("enmId",1001);
        map.put("username","zhangwuji");
        String jwtToken = JwtUtils.generateJwt(map);
        System.out.println("生成的令牌"+jwtToken);

    }
    @Test
    public void jjwtTset2() {
     String  jwt = "eyJhbGciOiJIUzI1NiJ9.eyJlbm1JZCI6MTAwMSwidXNlcm5hbWUiOiJ6aGFuZ3d1amkiLCJleHAiOjE3MDU3ODMzNTV9.R52JK7pnVhE9DiLiP09ZC2x1MnQjJm7jEgaYwKpvV7I";

        try {
            JwtUtils.parseJWT(jwt);
        } catch (Exception e) {
            System.out.println("令牌无效");
        }
    }
}
